package com.atguigu.gulimall.order.service;

import com.atguigu.common.to.mq.SeckillOrderTo;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.order.entity.OrderEntity;
import com.atguigu.gulimall.order.vo.*;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author fangdada
 * @email 1819675707@qq.com
 * @date 2021-05-01 11:01:38
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认页返回需要用的数据
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * @Author FangDaDa
     * @Description 创建订单
     * @Date 21:32 2021/9/2
     * @Param [vo]
     * @return com.atguigu.gulimall.order.vo.SubmitOrderResponseVo
     **/
    SubmitOrderResponseVo submitOrder(OrderSubmitVo vo);

    /**
     * 按照订单号获取订单信息
     * @param orderSn
     * @return
     */
	OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     * @param orderEntity
     */
    void closeOrder(OrderEntity orderEntity);

	/**
	 * 构造支付宝订单
	 * @author fd
	 * @date 2021/10/11 17:06
	 * @param orderSn
	 * @return com.atguigu.gulimall.order.vo.PayVo
	 */
	PayVo getOrderPay(String orderSn);

	/**
	 * 我的订单列表页
	 * @author fd
	 * @date 2021/10/12 14:28
	 * @param params 
	 * @return com.atguigu.common.utils.PageUtils
	 */
	PageUtils queryPageWithItem(Map<String, Object> params);
	
	/**
	 * 接收支付宝异步通知成功，去修改订单状态
	 * @author fd
	 * @date 2021/10/12 14:28
	 * @param asyncVo 
	 * @return java.lang.String
	 */
	String handlePayResult(PayAsyncVo asyncVo);

	/**
	 * 微信支付异步通知处理
	 * @author fd
	 * @date 2021/10/12 14:29
	 * @param notifyData 
	 * @return java.lang.String
	 */
	String asyncNotify(String notifyData);

	/**
	 * 创建秒杀单
	 * @param orderTo
	 */
	void createSeckillOrder(SeckillOrderTo orderTo);
}

